package com.ruoyi.common.utils.order;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author admin
 */
@Component
public class OrderUtil {


	/**
	 * 生成银行业务号
	 */
	public static String getBankLsh(String merchanTid){

        String orderId = merchanTid.substring(merchanTid.length()-9);;

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		long r1 = System.currentTimeMillis();
		String dateStr = sdf.format(new Date());
		if (dateStr != null){
			dateStr = dateStr.replaceAll("-", "");
		}
		String r1Str=String.valueOf(r1);
		if(r1Str.length()>=6){
			return orderId+dateStr+r1Str.substring(r1Str.length()-6,r1Str.length());
		}else {
            return orderId+dateStr+r1Str;
        }
	}



	public static void main(String[] args)
    {
        String a = "abcde123456789erf";

        System.out.println(getBankLsh(a));
    }
}
